package work;

import java.util.Scanner;

public class TestDemo {
    public static void main(String[] args) {
        Drink drink;
        Scanner console = new Scanner(System.in);
        System.out.print("请输入要买的饮料：");
        String message = console.nextLine();
        switch (message){
            case "咖啡":
                System.out.print("请输入要加什么：");
                String add = console.nextLine();
                drink = new coffee(add);
                drink.buy();
                break;
            case "矿泉水":
                drink = new water();
                drink.buy();
                break;
            case "可乐":
                System.out.print("请输入品牌：");
                String brand = console.nextLine();
                drink = new cola(brand);
                drink.buy();
                break;
        }
    }
}